<!-- 评论管理 -->
<template>
  <div class="">
    <n-data-table :columns="columns" :data="dataList" :bordered="true" />
  </div>
</template>
<script lang="ts" setup>
import { ref, h } from "vue";
import { dxget, dxpost, qurl, hf } from "../../util/index";
const props = defineProps({
  plid: {
    type: Number,
  },
  type: {
    type: String,
  },
});
let columns = [
  {
    title: "评论头像",
    width: "80",
    render(row) {
      return [h("img", { src: row.headPortrait, class: "uxzcdsrewrt" })];
    },
  },
  {
    title: "评论人昵称",
    width: "200",
    key: "nickname",
  },
  {
    title: "内容",
    key: "othString",
  },
  {
    title: "评论时间",
    key: "addTime",
    width: "180",
  },
  {
    title: "所在城市",
    key: "ipadder",
    width: "120",
  },
  {
    title: "操作",
    render(row) {
      return [
        h(
          "a",
          {
            class: "sz ls",
            onClick: async () => {
              await dxpost("xjyx/api/delsdpingl", { id: row.id });
              window.$message.success("删除成功");
              initsd();
            },
          },
          "删除"
        ),
      ];
    },
  },
];
const dataList = ref([]);
const initsd = async () => {
  const { data } = await dxget("xjyx/api/getpinglinsd", {
    actId: props.plid,
    type: props.type,
  });
  dataList.value = data;
};
initsd();
</script>
<style scoped></style>
